home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 2⁄23⁄90 / 0701-Re TTEView Question-Feb90 < prev    next >
Encoding:
Text File  |  1990-02-23  |  1.8 KB  |  52 lines  |  [TEXT/GEOL]

  1. Item forwarded  by  A33          to A34
  2.  
  3. Item    0438286                         17-Feb-90        03:06PST
  4.  
  5. From:   D5295                           Reseach SW Design, D Goldman,PRT
  6.  
  7. To:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. cc:     MADA2                           MacApp Dev Assoc, Curtis Faith,IVC
  10.  
  11. Sub:    Re: TTEView Question
  12.  
  13. John --
  14.  
  15. Thanks for pointing this out. I just recently wrote some methods which do a
  16. bunch of StuffTexts, and completely overlooked the fFreeText field. Based on a
  17. quick glance at StuffText (I didn't even look at TTEView.Free), I just assumed
  18. that StuffText was disposing its old hText/fText every time! So my code looks
  19. like:
  20.  
  21.                aHandle := handleToTheNewValue;
  22.                    FailOSErr(HandToHand(aHandle));
  23.                StuffText(aHandle);
  24.  
  25. This way I can dispose handleToTheNewValue whenever I feel like it, and TTEView
  26. can dispose hText/fText whenever IT feels like it. (At least it could if I also
  27. set fFreeText!)
  28.  
  29. Couldn't we get rid of fFreeText, fSavedTEHandle, and this entire discussion
  30. simply by having StuffText ALWAYS do the following:
  31.  
  32.                1) DisposIfHandle(fText);
  33.  
  34.                2) localHandle := theText;
  35.                   FailOSErr(HandToHand(localHandle));
  36.  
  37.                3) assign hText, fText, etc using localHandle    ?
  38.  
  39. True, we will always have two copies of the new text (my handleToTheNewValue
  40. and TTEView's fText/hText) taking up memory, but on the other hand we've
  41. eliminated fSavedTEHandle. So we come out even, right? Moreover, I can dispose
  42. handleToTheNewValue immediately after calling StuffText, if I like.
  43.  
  44. This seems much less kludgy than the deal with fFreeText and fSavedTEHandle. Am
  45. I missing something obvious?
  46.  
  47. -- Dave Goldman, D5295
  48.    Research Software Design
  49.     (Still not on MacApp.Tech$, for anyone who wants me to see their reply
  50.      before 2/23/90)
  51.  
  52.